package com.robooot.business_counter.model;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

/**
 * @author yinzq
 */

@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResultModel implements Serializable {

    private static final long serialVersionUID = 1L;

    private Integer result;

    private String message;

    private Object data;

    public static ResultModel ok(Object... object) {
        if (object.length > 0) {
            return new ResultModel(0,object[0]);
        }
        return new ResultModel(0,"SUCCESS");
    }

    public ResultModel(Integer result, String message, Object data) {
        this.result = result;
        this.message = message;
        this.data = data;
    }

    public ResultModel(Integer result, Object data) {
        this.result = result;
        this.data = data;
    }

    public ResultModel() {}

    public ResultModel(Integer result, String message) {
        this.result = result;
        this.message = message;
    }

    public Integer getResult() {
        return result;
    }

    public void setResult(Integer result) {
        this.result = result;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ResultModel{" +
                "result=" + result +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
